#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-nanoserver-1809 AS build
WORKDIR /src
COPY ["Src/MB.Rest/MB.Rest.csproj", "Src/MB.Rest/"]
COPY ["Src/MB.Models/MB.Models.csproj", "Src/MB.Models/"]
COPY ["Src/MB.Common/MB.Common.csproj", "Src/MB.Common/"]
COPY ["Src/MB.DAL/MB.DAL.csproj", "Src/MB.DAL/"]
COPY ["Src/MB.Rest.Core/MB.Rest.Core.csproj", "Src/MB.Rest.Core/"]
COPY ["Src/MB.Component/MB.Component.csproj", "Src/MB.Component/"]
COPY ["MB.TopSdk.Core/MB.TopSdk.Core.csproj", "MB.TopSdk.Core/"]
COPY ["Src/MB.Mvc.Core/MB.WebApi.Core.csproj", "Src/MB.Mvc.Core/"]
RUN dotnet restore "Src/MB.Rest/MB.Rest.csproj"
COPY . .
WORKDIR "/src/Src/MB.Rest"
RUN dotnet build "MB.Rest.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "MB.Rest.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MB.Rest.dll"]